<template>
    <div class="newsinfo-container">
        <h1 class="title">{{  newsInfo.title}} </h1>
        <p>
            <span>发表时间&nbsp;:&nbsp; {{ newsInfo.add_time | dateFormat}}</span>
            <span>点击次数&nbsp;:&nbsp;{{ newsInfo.click}} </span>
        </p>
        <hr>
        <div v-html="newsInfo.content"></div>
        <comment :id="newsInfo.id"></comment>
    </div>

</template>


<script>
import comment from "../subcomponents/comment.vue";


export default{
    data(){
        return {
            id:this.$route.params.id,
            newsInfo:[]
        }
    },
    created(){
        this.getNewsInfo();
    },
    methods:{
        getNewsInfo(){
            this.$http.get("http://www.liulongbin.top:3005/api/getnew/"+this.id).then(result => {
                if(result.body.status===0){
                    this.newsInfo=result.body.message[0];
                }
            })
        }
    },
    components:{
        comment
    }
}
</script>



<style lang="less" scoped>
.newsinfo-container{
    padding:0 4px;
    marigin-top:15px;
    .title{
        marigin-top:13px;
        font-size:15px;
        color:red;
        text-align: center;
    }
    h1{

    }
    p{
        font-size:13px;
        display: flex;
        justify-content: space-between;
        color:#25BDFB;
    }
}
</style>